#pragma once
#include <d3d9.h>
#include <d3dx9.h>
#include <map>
#include <string>
//#include <MMSystem.h>
using std::string;

class D3D9
{
private:
	D3DPRESENT_PARAMETERS	m_d3dpp;
	LPDIRECT3D9					m_pD3D9;
	LPDIRECT3DDEVICE9			m_pd3dDevice;
	LPD3DXSPRITE					m_pSprite;
	LPD3DXFONT					m_d3dFont;

	std::map<std::string, LPDIRECT3DTEXTURE9> textureMap;
public:
	D3D9(void);
	~D3D9(void);

	HRESULT InitD3D9(HWND hWnd, int nWidth, int nHeight, bool bFullScreen);

	void Reset();
	void ClearScene();
	HRESULT BeginPaint();
	void EndPaint();
	void Draw(string name, RECT rc, D3DXVECTOR3 pos, D3DXVECTOR3 center);
	void Draw(string name, RECT rc, D3DXVECTOR3 pos, D3DXVECTOR3 center, D3DXVECTOR3 rot, D3DXVECTOR3 sca);

	LPDIRECT3DDEVICE9 GetDevice(){return m_pd3dDevice;}
	LPD3DXSPRITE GetSprite(){return m_pSprite;}
};

